<?php
require_once('../model/m_login.php');

class login{

	public $usu_s ;
	public $pass_s ;
	public $datos = array();
	public $nombre;
	
	public function setValores(){
		$this->usu_s=$_GET['usuario'];
		$this->pass_s=$_GET['pass'];
		}
		
	public function ValidarLogin(){
		
		$this->datos = Mlogin($this->usu_s,$this->pass_s);
		$this->nombre = $this->datos[1]." ".$this->datos[2];
		
		//print_r($this->datos);
		
		if($this->datos[0]=="a"){

			return true;
			//header("location:../pag_princ.php");
			
			}else{
				return false;
				 //header("location:../index.php");
				}
		}	
	
	}
$ins = new login;
$ins->setValores();
$estado=$ins->ValidarLogin();

if($estado){
	
	session_start(); 
	
	$_SESSION['usr']= $ins->usu_s;
	$_SESSION['nombre']= $ins->nombre;
	$_SESSION['perf']= "Administrador";
	
	
	header("location:../../pag_princ.php");
	}else{
		header("location:../../index.php");
		}


?>